require.config({
	paths: {
		Cesium:		'../Build/Cesium/Cesium',
		Zlib:		'../Build/Cesium/Workers/zlib.min',
		jquery:		'jquery-2.1.4.min',
		bootstrap:	'bootstrap.min',
		supermap:	'supermap23',
		app:		'app23'
	},
	shim: {
		Cesium: {
			exports: 'Cesium'
		},
		Zlib : {
			exports : 'Zlib'
		},
		bootstrap : {
			deps : ['jquery'],
			exports: 'bootstrap'
		},
		layui : {
            deps : ['jquery'],
            exports: 'layui'
        }
	}
});
require(["Cesium","Zlib","jquery","supermap","app","bootstrap","layui"],function(cesium,zlib,$,SM,APP,BS,layui){
	APP.autodivheight();
    window.onresize = APP.autodivheight; //浏览器窗口发生变化时同时变化DIV高度
    
	/* 加载layui */
	layui.use(['element','form'], function(){
		var element = layui.element;
		var form = layui.form;
		//当条件查询select发生改变
		form.on('select(selectValue)', function(data){
			$('#sqlselectText1').val(data.value);
	    }); 
	});
	
	/* 加载layui */
	var viewer;
	var scene;
	SM.onload(cesium,APP);
	
	/* 一体化查询 */
	//打开SQL条件查询框
	$('#toolbar').on('click','#SQLselectClick',function(){ 
		$('.Vagueselectdiv').hide();
		if($('.sqlselectdiv').css('display')=='block') 
			$('.sqlselectdiv').fadeOut(160); 
		else 
			$('.sqlselectdiv').fadeIn(160); 
	}); 
	//SQL条件查询 
	$('body').on('click','#sqlselect',function(){ 
		APP.sqlselect();  
		$('.sqlselectdiv').fadeOut(160); 
	}); 
	//模糊查询
	$('#toolbar').on('click','#VagueSelect',function(){
		$('.sqlselectdiv').hide();
		if($('.Vagueselectdiv').css('display')=='block') 
			$('.Vagueselectdiv').fadeOut(160); 
		else 
			$('.Vagueselectdiv').fadeIn(160); 
	}); 
	$('#VagueSelectSubmit').click(function(){
		APP.VagueSelect();
		$('.Vagueselectdiv').fadeOut(160); 
	});
});